package com.MyTest;

import com.javabean.Role;
import com.javabean.User;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringTest {
    @Test
    public void t1 (){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean("u1");
        System.out.println(user);
    }

    @Test
    public void t2 (){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean("u2");
        System.out.println(user);
    }

    @Test
    public void t3 (){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean("u3");
        System.out.println(user);
        applicationContext.close();
    }

    @Test
    public void t4 (){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean("u4");
        System.out.println(user);
        applicationContext.close();
    }

    @Test
    public void t5 (){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean("u5");
        System.out.println(user);
        applicationContext.close();
    }

    @Test
    public void t6 (){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean("u6");
        System.out.println(user);
        applicationContext.close();
    }

    @Test
    public void t7 (){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean("u7");
        System.out.println(user);
        applicationContext.close();
    }

    @Test
    public void t8 (){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean("u8");
        System.out.println(user);
        applicationContext.close();
    }

    @Test
    public void t9 (){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean("u9");
        System.out.println(user);
        applicationContext.close();
    }

    @Test
    public void t10 (){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean("u10");
        System.out.println(user);
        applicationContext.close();
    }

    @Test
    public void t11 (){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        Role role = (Role) applicationContext.getBean("u11");
        System.out.println(role);
        applicationContext.close();
    }

    @Test
    public void t12 (){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean("u12");
        System.out.println(user);
    }

    @Test
    public void t13 (){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean("u13");
        System.out.println(user);
    }

    @Test
    public void t14 (){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean("u14");
        System.out.println(user);
    }

    @Test
    public void t15 (){
        ClassPathXmlApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) applicationContext.getBean("u15");
        System.out.println(user);
    }
}
